﻿@model Storage.Mapping.Bucket.BucketMapping
@{
    ViewBag.Title = "编辑Bucket";
    var appList = ViewBag.AppList as List<Storage.Mapping.AppStorage.AppStorageMapping>;
}
<h1>@ViewBag.Title</h1>
<hr />
<div class="row">
    <div class="col-sm-12">
        @using (Html.BeginRouteForm("editBucket", null, FormMethod.Post, new { @class = "form-horizontal",onsubmit="return false;" }))
        {
            @Html.HiddenFor(m => m.Id)
            @Html.AntiForgeryToken()
            <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right">应用选择</label>
                <div class="col-sm-2">
                    <select class="form-control" name="AppStorageId">
                        @foreach (var item in appList)
                        {
                            <option value="@item.Id">@item.Name</option>
                        }
                    </select>
                </div>
            </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label no-padding-right">@RequiredSpan() Bucket名称</label>
                    <div class="col-sm-2">
                        @Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "请输入Bucket名称" })
                        @Html.ValidationMessageFor(m => m.Name)
                    </div>
                </div>
                <div class="col-md-offset-2 col-md-9">
                    <button class="btn btn-info" type="submit">
                        <i class="ace-icon fa fa-check bigger-110"></i>
                        提交
                    </button>
                </div>
        }
    </div>
</div>
<script>

    $(function () {
        $.validator.unobtrusive.parse($('form'));
        $('form').submit(function (e) {
            e.preventDefault();
            if($(this).valid()){
                $.modal.show();
                $(this).ajaxSubmit(function (data) {
                    $.modal.gritter(data, function () {
                        window.location.href = '/admin/home#page' + '@Url.RouteUrl("bucketIndex")';
                    });
                });
             }
        });

    });
</script>























